package com.sh.rabbitmq;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.CancelCallback;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;
import com.sh.rabbitmq.utils.ChannelFactory;

public class Consumer2 {

    public static final String EXCHANGE_NAME = "dead_exchange";

    public static void main(String[] args) throws Exception {
        Channel channel = ChannelFactory.getChannel();

        //channel.queueBind("dead_queue",EXCHANGE_NAME,"lisi");


        DeliverCallback deliverCallback = (var1,var2)->{
            String msg = new String(var2.getBody());
            System.out.println("接收到的消息："+ msg);
        };

        CancelCallback cancelCallback = var1 ->{
            System.out.println("回调了");
        };

        System.out.println("C2正在等待接收");
        channel.basicConsume("dead_queue",true,deliverCallback,cancelCallback);
    }
}
